<%@ Page Title="Sys_AdminInfo Item" Language="C#" AutoEventWireup="true" CodeBehind="Sys_AdminInfoItem.aspx.cs" Inherits="Youz.CreditRepay.Manage.Sys_AdminInfoItem" %>

<script>
    

    var requireJS = [
        //"assets/js/jquery.form.js"
    ];
    loadJS(requireJS);
</script>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h2><i class="fa fa-edit"></i><%: R(LanguageModule.Sys_AdminInfo, "Sys_AdminInfo", "Sys_AdminInfo") %></h2>
            </div>
            <div class="panel-body">
                <form id="frm" class="form-horizontal" method="post" enctype="multipart/form-data" action="Sys/Handlers/Sys_AdminInfoHandler.ashx?type=save">
                    <input id="ISMemberAccount" name="ISMemberAccount" type="hidden" value="<%= WebHelper.Get("MemberAccount")==""?"add":"update" %>" />
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "MemberAccount", "帐号") %></label>
                        <div class="controls">
                            <input type="text" id="MemberAccount" name="MemberAccount" maxlength="50" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "FirstName", "姓") %></label>
                        <div class="controls">
                            <input type="text" id="FirstName" name="FirstName" maxlength="50" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "LastName", "名") %></label>
                        <div class="controls">
                            <input type="text" id="LastName" name="LastName" maxlength="50" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "Sex", "性别") %></label>
                        <div class="controls">
                            <label class="switch switch-info">
                                <input type="checkbox" id="Sex" name="Sex" class="switch-input" /><span class="switch-label" data-on="女" data-off="男"></span><span class="switch-handle"></span></label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "Email", "Email") %></label>
                        <div class="controls">
                            <input type="text" id="Email" name="Email" maxlength="50" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "MobileNo", "手机号") %></label>
                        <div class="controls">
                            <input type="text" id="MobileNo" name="MobileNo" maxlength="50" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "Memo", "备注") %></label>
                        <div class="controls">
                            <textarea id="Memo" name="Memo" rows="3" maxlength="200" class="form-control"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "Status", "状态") %></label>
                        <div class="controls">
                            <div class="controls">
                                <select name="Status" id="Status" class="form-control required">
                                    <option value="1" selected>启用</option>
                                    <option value="2">禁用</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_AdminInfo, "IsModify", "是否可修改") %></label>
                        <div class="controls">
                            <label class="switch switch-info">
                                <input type="checkbox" id="IsModify" name="IsModify" class="switch-input" /><span class="switch-label" data-on="On" data-off="Off"></span><span class="switch-handle"></span></label>
                        </div>
                    </div>
                    <div class="alert alert-danger" style="display: none;">
                        <button type="button" class="close" data-dismiss="alert">×</button><strong>Oh snap!</strong><span class="content"></span>
                    </div>
                    <div class="form-actions">
                        <button class="btn btn-success" type="submit" id="btnSubmit"><%: R(LanguageModule.M_Common, "btnSubmit", "保存修改") %></button>
                        <button class="btn btn-default" type="button" id="btnCancel"><%: R(LanguageModule.M_Common, "btnCancel", "取消") %></button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    var flag = false;

    function validate() {
        return $("#frm").valid();
    };

    function get() {
        $.post("Sys/Handlers/Sys_AdminInfoHandler.ashx?type=get", { MemberAccount: "<%= WebHelper.Get("MemberAccount") %>" }, function (data) {
            $('#frm').fill(data);
            $("#Memo").val(data.Memo);
            $("#Status").val(data.Status);
        }, 'json');
    }

    $(function () {
        $("#frm").validate({
            errorElement: "span"
        }
        );

        get();
        if ("<%= WebHelper.Get("MemberAccount")%>" != "") {
            $("#MemberAccount").attr("readOnly", "readOnly");
            //$("#DivLoginPwd").hide();
            //$("#DivLoginPwd1").hide();
        } else {
            $("#Sex").attr("checked", "checked");
            $("#IsModify").attr("checked", "checked");
        }
        $("#frm").ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, $form, options) {
                if (flag) {
                    return false;
                }
                else {
                    flag = true;
                    return true;
                }
            },
            success: function (data) {
                if (data.isSuccess) {
                    loadPage("Sys/Sys_AdminInfoList.aspx");
                }
                else {
                    $(".alert > .content").html(data.message);
                    $(".alert").show();
                }
                flag = false;
            }
        });

        $("#btnCancel").click(function () {
            loadPage("Sys/Sys_AdminInfoList.aspx");
        });
    });

</script>
